package com.xzlf.controller;

import com.xzlf.mail.SimpleMailDemo;
import freemarker.template.TemplateException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.mail.MessagingException;
import java.io.IOException;

@RestController
@RequestMapping("/mail")
public class MailController {

    @Autowired
    private SimpleMailDemo simpleMailDemo;

    @GetMapping("/send01")
    public String send01(){
        simpleMailDemo.sendEmail();
        return "send01";
    }
    @GetMapping("/send02")
    public String send02() throws MessagingException {
        simpleMailDemo.sendEmail02();
        return "send02";
    }
    @GetMapping("/send03")
    public String send03() throws MessagingException, IOException, TemplateException {
        simpleMailDemo.sendEmail03();
        return "send03";
    }
}
